package com.dragon.app.commons.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.dragon.loan.entity.CmAttachment;

public class AttachmentPictureDTO implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private Long id;
	private String typeId;
	private String fileId;
	private String loadId;
	private String userId;
	private String fileUrl;
	private String thumbnailsUrl;
	
	public static AttachmentPictureDTO getAttachmentPictureDTO(CmAttachment cmAttachment){
		AttachmentPictureDTO attachmentPictureDTO = new AttachmentPictureDTO();
		attachmentPictureDTO.setFileUrl(cmAttachment.getFileLocation());
		attachmentPictureDTO.setTypeId(cmAttachment.getAtmtType());
		attachmentPictureDTO.setFileId(cmAttachment.getFileId());
		attachmentPictureDTO.setLoadId(cmAttachment.getLoanId());
		attachmentPictureDTO.setUserId(cmAttachment.getUploadUserId());
		attachmentPictureDTO.setThumbnailsUrl(cmAttachment.getThumbnailsUrl());
		attachmentPictureDTO.setId(cmAttachment.getId());
		return attachmentPictureDTO;
	}
	
	public static List<AttachmentPictureDTO> getAttachmentPictureDTO(List<CmAttachment> cmAttachments){
		List<AttachmentPictureDTO> list = new ArrayList<AttachmentPictureDTO>();
		for (CmAttachment cmAttachment : cmAttachments) {
			AttachmentPictureDTO attachmentPictureDTO = new AttachmentPictureDTO();
			attachmentPictureDTO.setFileUrl(cmAttachment.getFileLocation());
			attachmentPictureDTO.setTypeId(cmAttachment.getAtmtType());
			attachmentPictureDTO.setFileId(cmAttachment.getFileId());
			attachmentPictureDTO.setLoadId(cmAttachment.getLoanId());
			attachmentPictureDTO.setUserId(cmAttachment.getUploadUserId());
			attachmentPictureDTO.setThumbnailsUrl(cmAttachment.getThumbnailsUrl());
			attachmentPictureDTO.setId(cmAttachment.getId());
			list.add(attachmentPictureDTO);
		}
		return list;
	}
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}

	public String getThumbnailsUrl() {
		return thumbnailsUrl;
	}

	public void setThumbnailsUrl(String thumbnailsUrl) {
		this.thumbnailsUrl = thumbnailsUrl;
	}

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}

	public String getFileId() {
		return fileId;
	}

	public void setFileId(String fileId) {
		this.fileId = fileId;
	}

	public String getLoadId() {
		return loadId;
	}
	public void setLoadId(String loadId) {
		this.loadId = loadId;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public String getFileUrl() {
		return fileUrl;
	}
	public void setFileUrl(String fileUrl) {
		this.fileUrl = fileUrl;
	}
}
